/**
 * Copyright (C), 2016-2019
 * FileName: FileUploadController
 * Author:   yacnog_liu
 * Date:     2019/4/5 0:21
 * Description:
 */
package com.mayi.bootdemo.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@RestController
public class FileUploadController {

    @RequestMapping("/fileUploadController")
    public Map<String, Object> upload(MultipartFile fileName) throws IOException {
        Map<String, Object> map = new HashMap<String, Object>(1);
        System.out.println(fileName.getOriginalFilename());
        fileName.transferTo(new File("D:/" + fileName.getOriginalFilename()));

        map.put("msg", "上传成功");

        return map;

    }
}
